/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
 * See cxx source for full Copyright notice                               */

/* $Id: AliAnalysisTaskMCtrue.h 45956 2010-12-10 12:55:37Z agheata $ */
/* AliAnalysisTaskMCtrue.h
 *
 * Template task producing a P_t spectrum and pseudorapidity distribution.
 * Includes explanations of physics and primary track selections
 *
 * Based on tutorial example from offline pages
 * Edited by Arvinder Palaha
 */
#ifndef ALIANALYSISTASKMCTRUEPHI_H
#define ALIANALYSISTASKMCTRUEPHI_H

class TH1F;
class TList;
class TH2F;
class AliESDtrackCuts;
class THnSparse;
class TH1D;

#ifndef ALIANALYSISTASKSE_H
#include "AliAnalysisTaskSE.h"
#endif

class AliAnalysisTaskMCtruePhi : public AliAnalysisTaskSE {
 public:
    AliAnalysisTaskMCtruePhi();
    AliAnalysisTaskMCtruePhi(const char *name);
    virtual ~AliAnalysisTaskMCtruePhi();
    
    virtual void    UserCreateOutputObjects();
    virtual void    UserExec(Option_t *option);
    virtual void    UserExecPhi(Float_t PhiShift);
    virtual void    Terminate(Option_t *);
    virtual void    SetVtxDiamond(Double_t Vx, Double_t Vy, Double_t Vz) {fVxMax = Vx;fVyMax =Vy;fVzMax = Vz;}
    virtual void    SetPhiConfiguration(Int_t NSectors, Int_t NPhiSteps ) {fNSectors = NSectors; fNPhiSteps = NPhiSteps;}

    virtual void    SetEtaConfiguration(Int_t NEtaBins, Int_t EtaSizeInBins, Int_t EtaStepInBins, Int_t NEtaConfigs)
    {fNEtaBins = NEtaBins; fEtaSizeInBins = EtaSizeInBins; fEtaStepInBins = EtaStepInBins; fNEtaConfigs = NEtaConfigs; }

    virtual void    SetPtMin(Double_t PtMin) {PT_MIN = PtMin;}
    virtual void    SetPtMax(Double_t PtMax) {PT_MAX = PtMax;}
    virtual void    SetMinMult(Int_t NMin) {MinMult = NMin;}

 private:

    Double_t        fVxMax;          // X vrtx max
    Double_t        fVyMax;          // Y vrtx max
    Double_t        fVzMax;          // Z vrtx max

    Int_t           fNSectors;       // Number of azimuthal sector
    Int_t           fNPhiSteps;      // Number of Phi steps
    Int_t           fNEtaBins;       //Number of Eta bins in Event hists
    Int_t           fEtaSizeInBins;  //Eta Size of the windows in bins of Event hist
    Int_t           fEtaStepInBins;  //Eta Step between windows in bins of Event hist
    Int_t           fNEtaConfigs;    //total number of eta configs

    Double_t        PT_MIN;          //Pt min used in analysis
    Double_t        PT_MAX;          //Pt max used in analysis
    Int_t           MinMult;         //min multiplicity for event to be considered

    TList           *fOutput;        // Output list
    TH1F            *fHistPtPlus;    // Pt spectrum for positive particles before Pt Eta cuts
    TH1F            *fHistPtMinus;   // Pt spectrum for negative particles before Pt Eta cuts
    TH1F            *fHistPt;        // Pt spectrum for all particles before Pt Eta cuts
    TH1F            *fHistPtPlusAfterPtCut; //Pt spectrum for positive particles after Pt cut
    TH1F            *fHistPtMinusAfterPtCut;//Pt spectrum for negative particles after Pt cut
    TH1F            *fHistPtAfterPtCut; //Pt spectrum for charged particles after Pt cut
    TH1F            *fHistEtaPlus;   // Eta spectrum for positive particles before Pt Eta cuts
    TH1F            *fHistEtaMinus;   // Eta spectrum for negative particles before Pt Eta cuts
    TH1F            *fHistEta;        // Eta spectrum for charged particles before Pt Eta cuts
    TH1F            *fHistEtaPlusAfterPtCut; // Eta spectrum for positive particles after Pt cut
    TH1F            *fHistEtaMinusAfterPtCut; // Eta spectrum for negative particles after Pt cut
    TH1F            *fHistEtaAfterPtCut; // Eta spectrum for charged particles after Pt cut

    TH1F            *fHistEtaPlusAfterCuts; // Eta spectrum for + particles after all cuts
    TH1F            *fHistEtaMinusAfterCuts; // Eta spectrum for - particles after all cuts
    TH1F            *fHistEtaAfterCuts;  // Eta spectrum for charged particles after all cuts

    TH1F            *fHistPtPlusAfterCuts; // Pt spectrum for + particles after all cuts
    TH1F            *fHistPtMinusAfterCuts; // Pt spectrum for - particles after all cuts
    TH1F            *fHistPtAfterCuts;   // Pt spectrum for charged particles after all cuts

    TH2F            *ffHistEtaPtPlusAfterCuts; // Eta Pt spectrum for + particles after all cuts
    TH2F            *ffHistEtaPtMinusAfterCuts; // Eta Pt spectrum for - particles after all cuts
    TH2F            *ffHistEtaPtAfterCuts; // Eta Pt spectrum for charged particles after all cuts

    AliESDtrackCuts *fTrackCuts;     // Track cuts
    TH1I            *fHistCharge;    // charge spectrum
    TH1F            *fHistVtxX;      //vertex x coordinate distribution
    TH1F            *fHistVtxY;      //vertex y coordinate distribution
    TH1F            *fHistVtxZ;      //vertex z coordinate distribution
    TH1I            *fHistMClabels;
    TH1F            *fHistNch;         //N of Nch particles in event before Pt Eta cuts
    TH1F            *fHistNchAccepted; //N of Nch particles in event after Pt Eta cuts)

    TH2F            *ffHistEtaPhiPlus;  //EtaPhi distribution for positive particles after all cuts
    TH2F            *ffHistEtaPhiMinus; //EtaPhi distribution for negative particles after all cuts
    TH2F            *ffHistEtaPhi;

    TH2F            *ffHistEtaPhiPlus64;  //EtaPhi distribution for positive particles after all cuts 8x8
    TH2F            *ffHistEtaPhiMinus64; //EtaPhi distribution for negative particles after all cuts 8x8
    TH2F            *ffHistEtaPhi64;


    THnSparseF        **fHistsSparse;   //array of sparse hists for every config of eta windows

    TH2F            *ffHistNpEvent;
    TH2F            *ffHistNmEvent;
    //TH2F            *fHistPtEtaEvent;
    TH1I            *fHistNchEvent;
    TH1I            *fHistNchAcceptedEvent;
    TH1D            *fHistEventCutStats;  //Hist for displaying EventCut statistics
    TH1D            *fHistTrackCutStats;  //Hist for displaying TrackCut statistics

   // NEW HISTO to be declared here
    
    AliAnalysisTaskMCtruePhi(const AliAnalysisTaskMCtruePhi&); // not implemented
    AliAnalysisTaskMCtruePhi& operator=(const AliAnalysisTaskMCtruePhi&); // not implemented
    
    ClassDef(AliAnalysisTaskMCtruePhi, 2); // example of analysis
};

#endif

